Media Messages
Enterprise can send messages containing images, videos and documents to his customers.
Before You Start
You need to meet all the prerequisites listed in the Before You Start section of the documentation.
Step 1: Make POST Request
Image Message
Parameters:
Name | Description | JSON Type | Default | Constraints | Required |
---|---|---|---|---|---|
type | Constant value media. | String | N/A | media | Yes |
mediaUrl | Public url of the image file. Should be either HTTP or HTTPS link. | String | N/A | N/A | Yes |
caption | Caption that will be displayed underneath the image. | String | None | 1024 Characters | No |
contentType | Format of media file. | String | None | image/jpeg | Yes |
Payload: image
{
"messages": [
{
"sender": "918882XXXXXX",
"to": "919999XXXXXX",
"messageId": "xxxxx",
"transactionId": "dsfsdfdfadgdfhh69665fd6",
"callbackDlrUrl": "http://xxx.com",
"channel": "wa",
"type": "media",
"media": {
"contentType": "image/jpeg",
"caption": "Hi",
"mediaUrl": "https://sample-videos.com/img/Sample-jpg-image-100kb.jpg"
}
}
],
"responseType": "json"
}
Note: Any image media file sent through the Sinch WhatsApp API can be atmost be 5 MB after processing.
Video Message
Parameters:
Name | Description | JSON Type | Default | Constraints | Required |
---|---|---|---|---|---|
type | Constant value media. | String | N/A | media | Yes |
mediaUrl | Public url of the video file (mp4). Should be either HTTP or HTTPS link. | String | N/A | N/A | Yes |
caption | Caption that will be displayed underneath the video. | String | None | 1024 characters | No |
contentType | Format of media file. | String | None | Video/mp4 | Yes |
Payload: video
{
"messages": [
{
"sender": "918882XXXXXX",
"to": "919999XXXXXX",
"messageId": "xxxxx",
"transactionId": "dsfsdfdfadgdfhh69665fd6",
"callbackDlrUrl": "http://xxx.com",
"channel": "wa",
"type": "media",
"media": {
"contentType": "image/jpeg",
"caption": "Hi",
"mediaUrl": "https://sample-videos.com/img/Sample-jpg-image-100kb.jpg"
}
}
],
"responseType": "json"
}
Note: Any video media file sent through the Sinch WhatsApp API can be atmost 16 MB after processing.
Document Message
Parameters:
Name | Description | JSON Type | Default | Constraints | Required |
---|---|---|---|---|---|
type | Constant value media. | String | N/A | media | Yes |
mediaUrl | Public url of the document file. Should be either HTTP or HTTPS link. | String | N/A | N/A | Yes |
contentType | Format of media file. | String | None | application/pdf, application/zip | Yes |
caption | Caption that will be displayed as the document title. | String | None | 1024 characters | No |
Payload: document pdf
{
"messages": [
{
"sender": "918010XXXXXX",
"to": "919999XXXXXX",
"messageId": "",
"transactionId": "",
"callbackDlrUrl": "http://xxx.com",
"channel": "wa",
"type": "media",
"media": {
"contentType": "application/pdf",
"caption": "Hi",
"mediaUrl": "https://sample-file.com/pdf/Sample-file.pdf"
}
}
],
"responseType": "json"
}
Payload: document zip
{
"messages": [
{
"sender": "918010XXXXXX",
"to": "919999XXXXXX",
"messageId": "",
"transactionId": "",
"callbackDlrUrl": "http://xxx.com",
"channel": "wa",
"type": "media",
"media": {
"contentType": "application/zip",
"caption": "Hi",
"mediaUrl": "https://sample-videos.com/zip/abc.zip"
}
}
],
"responseType": "json"
}
Note: Any document media file sent through the Sinch WhatsApp API can be atmost 100 MB after processing.
Step 2: Check Your Response
The response example shows a sample response from the API request: Possible elements in responses includes,
- Success Response
Payload
{
"success": true,
"responseId": "1606887827245734233232332"
}
- An unsuccessful response contains an error message. See Error and Status Codes for more information.
Note : Calback URL is a optional paramter . Please use when you want to change the default URL(configured through smartta). It will only chnage the domain name othere paratemters will be same as configurated in smartta.